E:/E+I/Informatik/Projekte/FH/n-Damen Problem/ssolution.c

Go to the documentation of this file.
00001 #include "ndame.h"
00002 
00003 void ssolution(struct data*d1)
00004 {
00005     FILE *pfile;
00006     int ik;
00007     int ii;
00008    
00009     pfile=fopen(d1->cfilename,"a");
00010     if(!pfile)
00011     {
00012         gotoxy(3,16);
00013         printf("Filename Error!");
00014         gotoxy(3,17);
00015         printf("Cant write [%s]",d1->cfilename);
00016     }
00017     else
00018     {
00019         
00020         if(!d1->iauthor)
00021         {
00022             fprintf(pfile,"%d-DAMEN-PROBLEM\nAuthor : Daniel Hasemann\nVersion : 1.0\n\n",d1->iblength);
00023             d1->iauthor=1;
00024         }
00025         
00026         for(ii=0;ii<d1->iblength;ii++)
00027         {   
00028             for(ik=0;ik<d1->iblength;ik++)
00029             {
00030                 if(d1->iboard[ik][ii])
00031                 {
00032                     fprintf(pfile,"[%c%d]   ",ii+65,d1->iblength-ik);
00033                 }    
00034                
00035             }
00036         }
00037         fprintf(pfile,"  >>>Solution [%d] ",d1->isolutions);
00038         fprintf(pfile,"\n");
00039         fclose(pfile);
00040     }
00041 }

Generated on Sun Dec 18 19:26:14 2005 for n-Queens Problem by  doxygen 1.4.5